//
//  DestinationTableViewCell.m
//  TeamProject_Travel
//
//  Created by lanou3g on 16/3/25.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "DestinationTableViewCell.h"

@implementation DestinationTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initLayout];
    }
    return self;
}

- (void)initLayout{
    self.backImageView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, [UIScreen mainScreen].bounds.size.width / 3, [UIScreen mainScreen].bounds.size.width * 2 / 9)];
    [self.contentView addSubview:self.backImageView];
    
    self.countLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetHeight(self.backImageView.frame) - 25, CGRectGetWidth(self.backImageView.frame), 25)];
    self.countLabel.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:0.6];
    self.countLabel.textAlignment = NSTextAlignmentCenter;
    self.countLabel.textColor = [UIColor orangeColor];
    [self.backImageView addSubview:self.countLabel];
    
    self.titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.backImageView.frame) + 10, 5, [UIScreen mainScreen].bounds.size.width - CGRectGetWidth(self.backImageView.frame), CGRectGetHeight(self.backImageView.frame) / 4)];
    [self.contentView addSubview:self.titlelabel];
    
    self.straImageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.titlelabel.frame), CGRectGetMaxY(self.titlelabel.frame), CGRectGetHeight(self.backImageView.frame) / 5, CGRectGetHeight(self.backImageView.frame) / 5)];
    self.straImageView1.image = [UIImage imageNamed:@"starK.png"];
    self.straImageView1.tag = 1;
    [self.contentView addSubview:self.straImageView1];
    
    self.straImageView2 = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.straImageView1.frame), CGRectGetMaxY(self.titlelabel.frame), CGRectGetHeight(self.backImageView.frame) / 5, CGRectGetHeight(self.backImageView.frame) / 5)];
    self.straImageView2.image = [UIImage imageNamed:@"starK.png"];
    self.straImageView2.tag = 2;
    [self.contentView addSubview:self.straImageView2];
    
    self.straImageView3 = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.straImageView2.frame), CGRectGetMaxY(self.titlelabel.frame), CGRectGetHeight(self.backImageView.frame) / 5, CGRectGetHeight(self.backImageView.frame) / 5)];
    self.straImageView3.image = [UIImage imageNamed:@"starK.png"];
    self.straImageView3.tag = 3;
    [self.contentView addSubview:self.straImageView3];
    
    self.straImageView4 = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.straImageView3.frame), CGRectGetMaxY(self.titlelabel.frame), CGRectGetHeight(self.backImageView.frame) / 5, CGRectGetHeight(self.backImageView.frame) / 5)];
    self.straImageView4.image = [UIImage imageNamed:@"starK.png"];
    self.straImageView4.tag = 4;
    [self.contentView addSubview:self.straImageView4];
    
    self.straImageView5 = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.straImageView4.frame), CGRectGetMaxY(self.titlelabel.frame), CGRectGetHeight(self.backImageView.frame) / 5, CGRectGetHeight(self.backImageView.frame) / 5)];
    self.straImageView5.image = [UIImage imageNamed:@"starK.png"];
    self.straImageView5.tag = 5;
    [self.contentView addSubview:self.straImageView5];
    
    
    self.descriptionLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.titlelabel.frame), CGRectGetMaxY(self.straImageView1.frame), CGRectGetWidth(self.titlelabel.frame) - 10, CGRectGetHeight(self.backImageView.frame) / 2)];
    self.descriptionLabel.numberOfLines = 2;
    [self.contentView addSubview:self.descriptionLabel];
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
